#!/bin/bash 
set -e


TMP=${TMP:-/tmp/work}
LOG=${LOG:-$HOME/logs/stage4}
SRC=${SRC:-/sources}

name=python3-commonmark
version=0.9.1

rm -rf $TMP
mkdir -p $TMP $LOG

tar xf $SRC/${name/python3-/}-$version.tar.gz -C $TMP

{ time \
   {

    cd $TMP/${name/python3-/}-$version
    
    python3 setup.py build
    
    python3 setup.py install --optimize=1

    }
} 2>&1 | tee $name.log
    
[ $PIPESTATUS = 0 ] && mv $name.log $LOG || exit $PIPESTATUS

rm -fr $TMP
